package com.g8.pethospitallearnbackend.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import java.io.Serializable;
import java.lang.reflect.Field;
import java.sql.Date;
import java.time.LocalDate;
import java.time.LocalTime;


@AllArgsConstructor
@Data
@Slf4j
public class Case implements Serializable {
    //真神奇，字段顺序也要和数据库中一致
    private String caseId;

    private String caseDiseases;

    private Date caseTime;

    private String petInfo;

    private String caseSymptom;

    private String caseCheck;

    private String caseDiagnosis;

    private String caseMedicine;

    private String caseTreat;

    private String caseSymptomPic;

    private String caseSymptomVideo;

    private String caseCheckPic;

    private String caseCheckVideo;

    private String caseDiagnosisPic;

    private String caseDiagnosisVideo;

    private String caseTreatPic;

    private String caseTreatVideo;

    private String default1;
    private String default2;
    private String default3;

    private static final long serialVersionUID = 1L;


    //构造函数是不是要好多？


    // 根据属性名获取属性值的通用方法
    public Object getPropertyValue(String propertyName) {
        try {
            // 获取对象的 Class
            Class<?> clazz = this.getClass();
            // 根据属性名获取对应的 Field 对象
            Field field = clazz.getDeclaredField(propertyName);
            // 设置私有属性可访问
            field.setAccessible(true);
            // 返回该属性的值
            return field.get(this);
        } catch (NoSuchFieldException | IllegalAccessException e) {
            log.info("没有该字段");
            e.printStackTrace(); // 或者进行适当的异常处理
            return null;
        }
    }
    public String getCaseId() {
        return caseId;
    }

    public void setCaseId(String caseId) {
        this.caseId = caseId;
    }

    public Date getCaseTime() {
        return caseTime;
    }

    public void setCaseTime(Date caseTime) {
        this.caseTime = caseTime;
    }

    public String getCaseDiseases() {
        return caseDiseases;
    }

    public void setCaseDiseases(String caseDiseases) {
        this.caseDiseases = caseDiseases;
    }

    public String getPetInfo() {
        return petInfo;
    }

    public void setPetInfo(String petInfo) {
        this.petInfo = petInfo;
    }

    public String getCaseSymptom() {
        return caseSymptom;
    }

    public void setCaseSymptom(String caseSymptom) {
        this.caseSymptom = caseSymptom;
    }

    public String getCaseCheck() {
        return caseCheck;
    }

    public void setCaseCheck(String caseCheck) {
        this.caseCheck = caseCheck;
    }

    public String getCaseDiagnosis() {
        return caseDiagnosis;
    }

    public void setCaseDiagnosis(String caseDiagnosis) {
        this.caseDiagnosis = caseDiagnosis;
    }

    public String getCaseMedicine() {
        return caseMedicine;
    }

    public void setCaseMedicine(String caseMedicine) {
        this.caseMedicine = caseMedicine;
    }

    public String getCaseTreat() {
        return caseTreat;
    }

    public void setCaseTreat(String caseTreat) {
        this.caseTreat = caseTreat;
    }

    public String getCaseSymptomPic() {
        return caseSymptomPic;
    }

    public void setCaseSymptomPic(String caseSymptomPic) {
        this.caseSymptomPic = caseSymptomPic;
    }

    public String getCaseSymptomVideo() {
        return caseSymptomVideo;
    }

    public void setCaseSymptomVideo(String caseSymptomVideo) {
        this.caseSymptomVideo = caseSymptomVideo;
    }

    public String getCaseCheckPic() {
        return caseCheckPic;
    }

    public void setCaseCheckPic(String caseCheckPic) {
        this.caseCheckPic = caseCheckPic;
    }

    public String getCaseCheckVideo() {
        return caseCheckVideo;
    }

    public void setCaseCheckVideo(String caseCheckVideo) {
        this.caseCheckVideo = caseCheckVideo;
    }

    public String getCaseDiagnosisPic() {
        return caseDiagnosisPic;
    }

    public void setCaseDiagnosisPic(String caseDiagnosisPic) {
        this.caseDiagnosisPic = caseDiagnosisPic;
    }

    public String getCaseDiagnosisVideo() {
        return caseDiagnosisVideo;
    }

    public void setCaseDiagnosisVideo(String caseDiagnosisVideo) {
        this.caseDiagnosisVideo = caseDiagnosisVideo;
    }

    public String getCaseTreatPic() {
        return caseTreatPic;
    }

    public void setCaseTreatPic(String caseTreatPic) {
        this.caseTreatPic = caseTreatPic;
    }

    public String getCaseTreatVideo() {
        return caseTreatVideo;
    }

    public void setCaseTreatVideo(String caseTreatVideo) {
        this.caseTreatVideo = caseTreatVideo;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", caseId=").append(caseId);
        sb.append(", caseTime=").append(caseTime);
        sb.append(", caseDiseases=").append(caseDiseases);
        sb.append(", petInfo=").append(petInfo);
        sb.append(", caseSymptom=").append(caseSymptom);
        sb.append(", caseCheck=").append(caseCheck);
        sb.append(", caseDiagnosis=").append(caseDiagnosis);
        sb.append(", caseMedicine=").append(caseMedicine);
        sb.append(", caseTreat=").append(caseTreat);
        sb.append(", caseSymptomPic=").append(caseSymptomPic);
        sb.append(", caseSymptomVideo=").append(caseSymptomVideo);
        sb.append(", caseCheckPic=").append(caseCheckPic);
        sb.append(", caseCheckVideo=").append(caseCheckVideo);
        sb.append(", caseDiagnosisPic=").append(caseDiagnosisPic);
        sb.append(", caseDiagnosisVideo=").append(caseDiagnosisVideo);
        sb.append(", caseTreatPic=").append(caseTreatPic);
        sb.append(", caseTreatVideo=").append(caseTreatVideo);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Case other = (Case) that;
        return (this.getCaseId() == null ? other.getCaseId() == null : this.getCaseId().equals(other.getCaseId()))
            && (this.getCaseTime() == null ? other.getCaseTime() == null : this.getCaseTime().equals(other.getCaseTime()))
            && (this.getCaseDiseases() == null ? other.getCaseDiseases() == null : this.getCaseDiseases().equals(other.getCaseDiseases()))
            && (this.getPetInfo() == null ? other.getPetInfo() == null : this.getPetInfo().equals(other.getPetInfo()))
            && (this.getCaseSymptom() == null ? other.getCaseSymptom() == null : this.getCaseSymptom().equals(other.getCaseSymptom()))
            && (this.getCaseCheck() == null ? other.getCaseCheck() == null : this.getCaseCheck().equals(other.getCaseCheck()))
            && (this.getCaseDiagnosis() == null ? other.getCaseDiagnosis() == null : this.getCaseDiagnosis().equals(other.getCaseDiagnosis()))
            && (this.getCaseMedicine() == null ? other.getCaseMedicine() == null : this.getCaseMedicine().equals(other.getCaseMedicine()))
            && (this.getCaseTreat() == null ? other.getCaseTreat() == null : this.getCaseTreat().equals(other.getCaseTreat()))
            && (this.getCaseSymptomPic() == null ? other.getCaseSymptomPic() == null : this.getCaseSymptomPic().equals(other.getCaseSymptomPic()))
            && (this.getCaseSymptomVideo() == null ? other.getCaseSymptomVideo() == null : this.getCaseSymptomVideo().equals(other.getCaseSymptomVideo()))
            && (this.getCaseCheckPic() == null ? other.getCaseCheckPic() == null : this.getCaseCheckPic().equals(other.getCaseCheckPic()))
            && (this.getCaseCheckVideo() == null ? other.getCaseCheckVideo() == null : this.getCaseCheckVideo().equals(other.getCaseCheckVideo()))
            && (this.getCaseDiagnosisPic() == null ? other.getCaseDiagnosisPic() == null : this.getCaseDiagnosisPic().equals(other.getCaseDiagnosisPic()))
            && (this.getCaseDiagnosisVideo() == null ? other.getCaseDiagnosisVideo() == null : this.getCaseDiagnosisVideo().equals(other.getCaseDiagnosisVideo()))
            && (this.getCaseTreatPic() == null ? other.getCaseTreatPic() == null : this.getCaseTreatPic().equals(other.getCaseTreatPic()))
            && (this.getCaseTreatVideo() == null ? other.getCaseTreatVideo() == null : this.getCaseTreatVideo().equals(other.getCaseTreatVideo()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getCaseId() == null) ? 0 : getCaseId().hashCode());
        result = prime * result + ((getCaseTime() == null) ? 0 : getCaseTime().hashCode());
        result = prime * result + ((getCaseDiseases() == null) ? 0 : getCaseDiseases().hashCode());
        result = prime * result + ((getPetInfo() == null) ? 0 : getPetInfo().hashCode());
        result = prime * result + ((getCaseSymptom() == null) ? 0 : getCaseSymptom().hashCode());
        result = prime * result + ((getCaseCheck() == null) ? 0 : getCaseCheck().hashCode());
        result = prime * result + ((getCaseDiagnosis() == null) ? 0 : getCaseDiagnosis().hashCode());
        result = prime * result + ((getCaseMedicine() == null) ? 0 : getCaseMedicine().hashCode());
        result = prime * result + ((getCaseTreat() == null) ? 0 : getCaseTreat().hashCode());
        result = prime * result + ((getCaseSymptomPic() == null) ? 0 : getCaseSymptomPic().hashCode());
        result = prime * result + ((getCaseSymptomVideo() == null) ? 0 : getCaseSymptomVideo().hashCode());
        result = prime * result + ((getCaseCheckPic() == null) ? 0 : getCaseCheckPic().hashCode());
        result = prime * result + ((getCaseCheckVideo() == null) ? 0 : getCaseCheckVideo().hashCode());
        result = prime * result + ((getCaseDiagnosisPic() == null) ? 0 : getCaseDiagnosisPic().hashCode());
        result = prime * result + ((getCaseDiagnosisVideo() == null) ? 0 : getCaseDiagnosisVideo().hashCode());
        result = prime * result + ((getCaseTreatPic() == null) ? 0 : getCaseTreatPic().hashCode());
        result = prime * result + ((getCaseTreatVideo() == null) ? 0 : getCaseTreatVideo().hashCode());
        return result;
    }
}